import { defineStore } from 'pinia'

const uniSystemInfo = uni.getSystemInfoSync()
const useSystemStore = defineStore('systemStore', () => {
  const systemInfo = reactive(uniSystemInfo)
  const statusBarHeight = computed(() => systemInfo.statusBarHeight)
  const screenHeight = computed(() => systemInfo.screenHeight)
  const windowHeight = computed(() => systemInfo.windowHeight)
  const safeBottom = computed(() => systemInfo.safeAreaInsets?.bottom ?? 0)

  return {
    systemInfo,
    statusBarHeight,
    screenHeight,
    windowHeight,
    safeBottom
  }
})

export default useSystemStore
